<style>
.btn.btn-success-o{
    background: #fff;
    border: 1px solid {{main.syscolor||'#05c175'}};
    color: {{main.syscolor||'#05c175'}};
}
.btn.btn-success-o.active{
    background: {{main.syscolor||'#05c175'}};
    border: 1px solid {{main.syscolor||'#05c175'}};
    color: #fff;
}
.btn.btn-success-o.active .subtitle{
    color: #f2f2f2;
}
</style>
<div class='fui-page fui-page-current'>
    <div class="fui-content">
		<div style="background: {{main.syscolor||'#05c175'}};margin-top:0;height:7rem">
			<i class="icon icon-licaishouyi" style="font-size:11rem;line-height:1;color:#fff;opacity:0.2;margin-top:-3rem"></i>
		</div>
		<div style="padding:0 0.5rem">
		<div class='fui-cell-title bold' style="padding:0;padding-top:0.5rem">换购券数量</div>
		<div class="fui-icon-group noborder col-3" style="margin-top:0.5rem">
			<div ng-repeat="item in pagedata.redfeeset" ng-click="pagedata.select($index);" class="fui-icon-col-sm" style="margin:0;margin-top:0.2rem;padding:0 0.2rem">
					<div ng-class="{'btn btn-success-o':1,'active':pagedata.item.money==item.fee}" style="line-height:1.4;margin:0;padding:0.3rem;width:100%">
					<div class="bold">￥{{item.fee}}</div>
					<div class="subtitle" style="font-size:12px;">获得 ￥{{item.fanfee}}</div>
					<div ng-if="pagedata.pluginset.is_songbi!=1" class="subtitle" style="font-size:12px;">每次返 {{item.onefanfee}}%</div>
					<div ng-if="pagedata.pluginset.is_songbi==1" class="subtitle" style="font-size:12px;">兑换券 {{item.jifenfee>0?item.jifenfee:item.fee}}</div>
					</div>
			</div>
		</div>
		<div class='fui-cell-group'>
			<div class='fui-cell'>
				<div class='fui-cell-label'>抢购消费券</div>
				<div class="fui-cell-info c000 bold" style="font-size:1rem">￥{{pagedata.item.money}}</div>
			</div>
		</div>
		</div>
		<a href="javascript:;" class='btn btn-success block' style="border-radius:1rem;line-height: 3;margin-top:1rem" ng-click="pagedata.recharge()">确认抢购</a>
		<a href="javascript:;" class='btn btn-gray block' style="border-radius:1rem;line-height: 3;" ng-click="access_json('jy_jinxiaofee/index/')">返回中心</a>
		<div ng-include="sys_html('common/_copyright',true)"></div>
</div>
</div>
<script>
scope.pagedata.select=function(index){
scope.pagedata.redfeeset[index].fee=parseInt(scope.pagedata.redfeeset[index].fee);
	if(scope.pagedata.maxcong && scope.pagedata.maxcong.price && scope.pagedata.redfeeset[index].fee<scope.pagedata.maxcong.price){
		scope.message('本次充值必须大于等于'+scope.pagedata.maxcong.price+'额度！');
		return false;
	}
	scope.pagedata.item.money=scope.pagedata.redfeeset[index].fee;
	scope.pagedata.item.key=index
	scope.$evalAsync();
}
scope.pagedata.recharge=function(){
	scope.post_json('jy_jinxiaofee/recharge/recharge/',scope.pagedata.item,function(pay_id){
		console.log('pay_id');console.log(pay_id);
		scope.tool.pay(pay_id,function(res){
				console.log('收到支付结果！');
				if(res.type=='success'){
					scope.message('充值成功！','','jy_jinxiaofee/index/');
				}else{
					scope.message('充值失败！'+res.message,'','jy_jinxiaofee/index/');
				}
		},'','','jy_jinxiaofee/index/');
	});
}
</script>